home *** CD-ROM | disk | FTP | other *** search
- /*
- * File: CExtendDragTask.c
- * Created: 8/1/93
- * Desc: A mousetask that handles dragging and dropping
- * in CItemTable.
- *
- * Superclass: CTableDragger.
- * Uses: CItemTable, CItem.
- * Original Author: W. Wesley Monroe
- * Modifications: Atul Barve
- *
- * Copyright © 1993 Animas Software Production. All rights reserved.
- */
-
- #include "CExtendDragTask.h"
- #include "CItemTable.h"
- #include "CItemList.h"
- #include "LongQD.h"
- #include "CItem.h"
-
- extern CBureaucrat *gGopher;
-
- void CExtendDragTask::IExtendDragTask(CTable *aTable,
- CView *dragBoundsPane,
- short theModifiers,
- long selFlags)
- {
- ITableDragger(aTable, theModifiers, selFlags);
-
-
- fEnclosingPano = dragBoundsPane;
- fGRDrawn = FALSE;
- fFirst = TRUE;
- fReleasedView = fOriginalView = aTable;
-
- fSelectedItems = 0L;
- }
-
- void CExtendDragTask::Dispose(void)
- {
- ForgetObject(fSelectedItems);
-
- inherited::Dispose();
- }
-
- void CExtendDragTask::BeginTracking(LongPt *startPt)
- {
- Cell hitCell;
- RgnHandle aRgn;
-
- inherited::BeginTracking(startPt);
- itsTable->FindHitCell(startPt, &hitCell);
-
- // Call Begin Tracking only if modifierkeys are down,
- // or the hitCell is not Selected.....
-
- fSelRect.top = startPt->v;
- fSelRect.bottom = startPt->v;
- fSelRect.left = startPt->h;
- fSelRect.right = startPt->v;
-
- }
-
- void CExtendDragTask::KeepTracking(LongPt *currPt, LongPt *prevPt,
- LongPt *startPt)
- {
- CView *theDropInView;
- CView *enclView = fEnclosingPano;
- CItemTable *dropInTable;
-
- PenState saveState;
- Point scp;
- Cell hitCell;
- Rect r, r2;
- Point cp;
-
- GetPenState(&saveState);
-
- if(fFirst && !EqualLongPt(currPt, prevPt)) {
- r = fSelRect;
- PenPat(gray);
- PenMode(srcXor);
- FrameRect(&r);
- fFirst = FALSE;
- fGRDrawn = TRUE;
- } else if(!EqualLongPt(currPt, prevPt)) {
- r = fSelRect;
- PenPat(gray);
- PenMode(srcXor);
- FrameRect(&r);
- if(currPt->h > startPt->h)
- fSelRect.right = currPt->h;
- else {
- fSelRect.right = startPt->h;
- fSelRect.left = currPt->h;
- }
-
- if(currPt->v > startPt->v)
- fSelRect.bottom = currPt->v;
- else {
- fSelRect.bottom = startPt->v;
- fSelRect.top = currPt->v;
- }
-
-
- r = fSelRect;
- FrameRect(&r);
- fGRDrawn = TRUE;
- fFirst = FALSE;
- inherited::KeepTracking(currPt,prevPt,startPt);
- }
- SetPenState(&saveState);
- }
-
- void CExtendDragTask::EndTracking(LongPt *currPt, LongPt *prevPt,
- LongPt *startPt)
- {
- CItemList *selList;
-
- Cell dropCell = {0, 0};
- Cell hitCell;
- PenState saveState;
- Rect r;
-
-
- // Erase the last gray region...
- if(fGRDrawn) {
-
- GetPenState(&saveState);
-
- PenPat(gray);
- PenMode(srcXor);
- r = fSelRect;
- FrameRect(&r);
-
- inherited::EndTracking(currPt,prevPt,startPt);
- SetPenState(&saveState);
-
- }
- // Region be gone...
- ASSERT(fReleasedView);
-
- selList = fSelectedItems;
-
- }
-